<template>
  <div class="transaction-service-list bg-c-fff right-height mb70">
    <p class="bread rel">
      <a href="javascript:void(0);" class="font-s-16">服务评价管理-律师评价</a>
    </p>
    <div class="content">
      <div class="seach">
        <input type="text" name="" class="input-css" v-model="keyWord" placeholder="客户名称/律师">
        <button class="xl-btn-css blue-button vb" @click="getEvaluateData(1)">搜索</button>
      </div>
      <table width="100%" class="auto">
        <tr>
          <th>提交时间</th>
          <th>客户名称</th>
          <th>律师</th>
          <th>满意程度</th>
          <th>操作</th>
        </tr>
        <tr v-for="item in evaluateList">
          <td>{{item.createTime}}</td>
          <td>{{item.customName}}</td>
          <td>{{item.lawyerName}}</td>
          <td>{{item.satisfactory|evaFilter}}</td>
          <td>
            <button class="blue-button small-btn-css" @click="onDetailsClick(item.id)">查看详情</button>
          </td>
        </tr>
      </table>
      <div class="no-data-tip" v-show="evaluateList.length===0">暂无相关数据</div>
      <div class="fix foot-box">
        <pagination :index="pageIndex" :total="pageTotal" v-show="this.evaluateList!=0" @pagechange="onPageChange"></pagination>
      </div>
    </div>
  </div>
</template>
<script type="text/javascript">
import Pagination from '../components/Pagination'
export default {
  components: {
    Pagination
  },
  data() {
    return {
      pageIndex: 1,
      pageTotal: 1,
      evaluateList: [],
      keyWord: ''
    }
  },
  mounted() {
    this.onPageChange(1)
  },
  methods: {
    onPageChange(n) {
      this.getEvaluateData(1)
    },
    getEvaluateData(n) {
      this.$http.post('/evaluate/query/list', {
        evaluateType: 1,
        search: this.keyWord
      }).then(data => {
        if (data.data.httpCode === 200) {
          this.pageIndex = n
          this.pageTotal = Math.ceil(data.data.total / 10)
          this.evaluateList = data.data.rows
          console.log(this.evaluateList)
        } else {
          console.log(data.data.msg)
          this.$toasted.show(data.data.msg)
        }
      }).catch(err => {
        console.log(err)
      })
    },
    onDetailsClick(id) {
      this.$router.push('/lawyer-evalua-details' + '?id=' + id)
    }
  },
  filters: {
    evaFilter(e) {
      if (e === '1') {
        return '不满意'
      }
      if (e === '2') {
        return '基本满意'
      }
      if (e === '3') {
        return '满意'
      }
    }
  }
}

</script>
<style type="text/css" scoped>
.bread {
  padding-left: 20px;
  border-bottom: 1px solid #ddd;
}

.bread a {
  line-height: 45px;
}

.content {
  padding: 0 30px;
}

.content .seach input,
.content .seach button {
  height: 35px;
  line-height: 35px;
}

.content .seach {
  padding: 20px 0px;
}

.content .seach button {
  margin-left: -5px;
}

.foot-box {
  padding: 35px 0px 0px 0px;
}

</style>
